Technical Field
The present invention relates to flash memory, and in particular to methods for moving data internally and apparatuses using the same.
Description of the Related Art
Flash memory devices typically include NOR flash devices and NAND flash devices. NOR flash devices are random access—a host accessing a NOR flash device can provide the device any address on its address pins and immediately retrieve data stored in that address on the device's data pins. NAND flash devices, on the other hand, are not random access but serial access. It is not possible for NOR to access any random address in the way described above. Instead, the host has to write into the device a sequence of bytes which identifies both the type of command requested (e.g. read, write, erase, etc.) and the address to be used for that command. The address identifies a page (the smallest chunk of flash memory that can be written in a single operation) or a block (the smallest chunk of flash memory that can be erased in a single operation), and not a single byte or word. In reality, the NAND flash device always reads from the memory cells and writes to the memory cells complete pages. After a page of data is read from the array into a buffer inside the device, the host can access the data bytes or words one by one by serially clocking them out using a strobe signal.
If the data in some of the pages of the block are no longer needed (also called stale pages), only the pages with good data in that block are read and rewritten into another previously erased empty block. Then the free pages and the stale pages are available for new data. This is a process called garbage collection. The process of garbage collection involves reading data from the flash memory and rewriting data to the flash memory. It means that a flash controller first requires a read of the whole block, and then a write of the parts of the block which still include valid data. This significantly consumes the bandwidth of an access interface coupled between a flash controller and storage units, leading to a performance reduction of the whole system. Conventionally, the flash controller issues copyback read commands to direct a logic circuit of a storage unit to take good data from pages and move to a data buffer thereof and issues copyback write commands to direct the logic circuit thereof to take good data from the data buffer thereof and program to another empty block, without moving the good data from/to the storage unit via the access interface. However, if good data and stale data are included in the same page, the copyback read commands and the copyback write commands cannot work. The flash controller still needs to read pages from the storage unit through the access interface, collects good data from the read pages and rewrite the good data in pages to another empty block of the storage unit through the access interface. Accordingly, what is needed are methods for moving data internally and apparatuses that use these methods to overcome the above drawbacks.